import { request1 } from './request'

export function getCheckout(data) {
  data['come_from'] = 'web'
  return request1({
    url: '/carts/checkout',
    method: 'post',
    data
  })
}

export function addAddresses(user_id,data) {
  return request1({
    url: `/users/${user_id}/addresses`,
    method:'post',
    data
  })
}
export function getAddresses(user_id) {
  return request1({
    url: `/users/${user_id}/addresses`,
  })
}

export function getRemarks(id,sig) {
 return request1({
    url: `/carts/${id}/remarks`,
    params: {
      sig
    }
  })
}

export function getOrders(user_id,cart_id,data) {
  // 这里写的都是可有可无的信息,没有也可以成功接收到请求
  data.come_from = 'mobile_web',
  data.deliver_time = ''
  return request1({
    url: `/users/${user_id}/carts/${cart_id}/orders`,
    method: 'post',
    data
  })
}